package cn.com.twoke.game.client.utils;

import java.awt.*;
import java.util.function.Consumer;

public class TextUtil {
	
	public static void drawAlignCenter(Graphics g, Rectangle hitbox, String text) {
		FontMetrics fm = g.getFontMetrics();
		g.drawString(text,
				hitbox.x + (hitbox.width - (int)fm.getStringBounds(text, g).getWidth()) / 2,
				hitbox.y + (hitbox.height - fm.getHeight()) / 2 + fm.getAscent()) ;
	}
	
	
}
